package org.example.lanchain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.lanchain.bean.KnowledgeDocument;

/**
 * 知识库文档Mapper接口
 * 继承MyBatis-Plus的BaseMapper，提供基础的CRUD操作
 */
@Mapper
public interface KnowledgeDocumentMapper extends BaseMapper<KnowledgeDocument> {

    /**
     * 查询总存储大小
     * 
     * @return 返回总存储大小（字节）
     */
    @Select("SELECT IFNULL(SUM(size), 0) FROM knowledge_document")
    Long selectTotalSize();

    /**
     * 查询总向量数量
     * 
     * @return 返回总向量数量
     */
    @Select("SELECT IFNULL(SUM(vector_count), 0) FROM knowledge_document")
    Integer selectTotalVectors();
} 